# _*_ coding: utf-8 _*_
"""
--------------------------------------
    File Name:    bcrypt
    Description:
    Author:       lhw
    Date:        5/28/20
--------------------------------------
    Change Activity:
                 
"""
__auther__ = 'lhw'
import bcrypt


class Bcrypt(object):
    encode = None
    
    def __init__(self):
        self.encode = 'utf-8'

    @staticmethod
    def encrypt(password):
        encode = 'utf-8'
        return bcrypt.hashpw(password.encode(encode), bcrypt.gensalt()).decode(encode)

    @staticmethod
    def check(password, encrypted):
        encode = 'utf-8'
        return bcrypt.checkpw(password.encode(encode), encrypted.encode(encode))

